#include "Struct.h"


Struct::Struct()
{
	m_destroy = true;
}

bool Struct::isDestroy() const
{
	return m_destroy;
}

std::string Struct::getRessourceStruct() const
{
	return "NULL";
}

sf::Vector2f Struct::getPosition() const
{
	return m_skin.getPosition();
}

sf::Vector2f Struct::getBox() const
{
	return sf::Vector2f(m_skin.getGlobalBounds().width, m_skin.getGlobalBounds().height);
}

int Struct::random(int a, int b)
{
    return rand()%(b-a) +a;
}

bool Struct::addWorker(WorkerUnit *worker)
{
	if(m_worker.size() >= m_nombreMaxWorker)
		return false;
	else
		m_worker.push_back(worker);

	return true;
}

void Struct::init(const sf::Vector2f position, const int team, ImgMgr *imageManager)
{
	m_idTeam = team;
	m_skin.setPosition(position);
	m_destroy = false;
}

void Struct::maj(Level *level, RessourceMgr *ressourceMgr)
{
	if(m_vie <= 0)
		m_destroy = true;
}

void Struct::render(sf::RenderWindow *app)
{
	if(!m_destroy)
		app->draw(m_skin);
}